package models

import (
	"backend/internal/biz"
	"time"
)

type Media struct {
	ID       uint      `json:"id" gorm:"primarykey"`
	URL      string    `json:"url" gorm:"column:url;not null;default:'';comment:媒体URL"`
	Type     string    `json:"type" gorm:"column:type;not null;default:'';comment:媒体类型 image/video/doc"`
	Dist     string    `json:"dist" gorm:"column:dist;not null;default:'';comment:媒体存在的位置"`
	CreateAt time.Time `json:"create_at" gorm:"column:create_at;not null;default:'';comment:创建时间"`
	DeleteAt time.Time `json:"delete_at" gorm:"column:delete_at;not null;default:'';comment:删除时间"`
}

func (m *Media) ToBiz() *biz.Media {
	return &biz.Media{
		ID:   m.ID,
		URL:  m.URL,
		Type: m.Type,
	}
}
